Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/cli offset #2591

Merged
merged 4 commits into from
Feb 22, 2022
Merged

Fix/cli offset #2591

merged 4 commits into from
Feb 22, 2022

Conversation

oscarssanchez
Copy link
Contributor

Description of the Change

This PR changes the current message that's being displayed when a WP CLI index is triggered with a specified offset. Introduces index_meta['skip_message_shown'] to check whether we have shown the Skipping X... message.

Closes #2557

Alternate Designs

Possible Drawbacks

Verification Process

Checklist:

  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests passed.

Changelog Entry

Credits

Props @

@oscarssanchez oscarssanchez changed the base branch from develop to 4.x.x February 12, 2022 01:54
Comment on lines 656 to 659
/* translators: 1. Number of objects indexed */
esc_html__( 'Skipping %1$d %2$s posts...', 'elasticpress' ),
$from,
esc_html( strtolower( $indexable->labels['plural'] ) )
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@oscarssanchez a few things in this block:

  1. The "translators" comment should be aligned with the esc_html__ call (an example here)
  2. It is missing the second placeholder description
  3. If I'm reading this right, the %2$s will become "posts", "users", etc., right? If so, won't it become Skipping 100 posts posts... (duplicated posts)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @felipeelia thanks i've fixed here a95e35d and here cf7cf41

@@ -648,10 +648,34 @@ function( $item ) {
}
}

$from = $this->index_meta['offset'] - count( $this->current_query['objects'] );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of placing this entire code inside of index_next_batch(), wouldn't it be better to add it to index_objects(), right before we actually start indexing things?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @felipeelia I've moved this code here: 993fe3b

@felipeelia felipeelia added this to the 4.0.0 (beta 2) milestone Feb 15, 2022
@felipeelia felipeelia merged commit 681bb19 into 4.x.x Feb 22, 2022
@felipeelia felipeelia deleted the fix/cli-offset branch February 22, 2022 19:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: WP-CLI index --offset not working
2 participants